geminilabs

[site-reviews] test db table structure

Oct 23rd, 2020 (edited)
861
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * This gets the database table structure for some of the tables
  3.  * to see if they share the same structure. If they don't, then
  4.  * this could be why the table constraints are throwing errors
  5.  */
  6. add_action('init', function() {
  7.     global $wpdb;
  8.     $dbTableStructure = $wpdb->get_results("
  9.        SELECT TABLE_NAME, TABLE_COLLATION, ENGINE
  10.        FROM information_schema.TABLES
  11.        WHERE TABLE_SCHEMA = '{$wpdb->dbname}' AND TABLE_NAME IN ('{$wpdb->posts}', '{$wpdb->users}', '{$wpdb->terms}', '{$wpdb->prefix}glsr_ratings', '{$wpdb->prefix}glsr_assigned_posts', '{$wpdb->prefix}glsr_assigned_terms', '{$wpdb->prefix}glsr_assigned_users')
  12.    ");
  13.     glsr_log($dbTableStructure);
  14. });
RAW Paste Data