How do you debug problems with a migration? I've created a simple migration to create a table for my plugin, but when I update the plugin via the CP, I get the following message:


  Craft was unable to install this update :( 
  
  The site has been restored
  to the state it was in before the attempted update.
  
  There was a problem updating your database.


As it's the only change to the plugin I think it's safe to say my migration isn't up to task. 

How do I know exactly what's wrong with my migration though? There don't appear to be any logs generated to show the actual error being caused. I'm running in devMode, and I can't see anything in the browser console and there don't appear to be any errors in the standard logs.

For reference, here is the migration I'm trying to run, which was created manually rather than using yiic:

&lt;?php
namespace Craft;

/**
 * The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_migrationName
 */
class m171129_103222_myplugin_createLogTable extends BaseMigration
{
    /**
     * Any migration code in here is wrapped inside of a transaction.
     *
     * @return bool
     */
    public function safeUp()
    {
        craft()-&gt;db-&gt;createCommand()-&gt;createTable('myplugin_log',
            array(
                'eventId' =&gt; array(AttributeType::Number, 'required' =&gt; true),
                'level' =&gt; array('column' =&gt; ColumnType::Varchar, 'maxLength' =&gt; 5, 'required' =&gt; true),
                'message' =&gt; array(AttributeType::String, 'required' =&gt; true),
                'date' =&gt; array(AttributeType::DateTime, 'required' =&gt; true),
            ));


        return true;
    }
}
Logs should be written to craft/storage/runtime/logs to help debug issues like this.  It gets a little sketchy with fatal errors, though.  Logs get flushed to disk when the onEndRequest event gets successfully fired.  If it's a fatal error that kills script execution, that event will never get fired and the logs don't get flushed.  That might have been what you're running into here.

Outside of that, to answer your original question, the absolute best way to debug stuff like this is with xDebug.  PhpStorm has a native xDebug client built in and it's pretty fantastic.