code: public function create_tables() {
  
  		global $wpdb;
  
  		$charset_collate = $wpdb->get_charset_collate();
  
  		$table_name = $wpdb->prefix . 'efg_custom_rating';
  
  		if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name ) {
  			$sql = "CREATE TABLE $table_name (
  	          id      mediumint(9) NOT NULL AUTO_INCREMENT,
  	          post_id mediumint(9) NOT NULL,
  	          ip      varchar(45)  NOT NULL,
  	          vote    int(2)       NOT NULL,
  	          PRIMARY KEY  (id)
  	        ) $charset_collate;";
  
  			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
  
  			dbDelta( $sql );
  		}
  	}
docs: Create database tables.