title: Yii2 Check if table exists in migration
body: <p>I have created a migration, whichi should create tables for my database, and insert default admin user.</p>
  
  <pre><code>&lt;?php
  
  //use Yii;
  use yii\db\Migration;
  use yii\db\Schema;
  
  /**
   * Class m180616_200856_create_tables
   */
  
  require_once( __DIR__.'/../config.php');
  
  
  class m180616_200856_create_tables extends Migration
  {
  
  
      public function up()
      {
  
          if (Yii::$app-&gt;db-&gt;schema-&gt;getTable("users",true)===null) {
              $this-&gt;createTable('users', [
                  'id' =&gt; $this-&gt;primaryKey(),
                  'username' =&gt; $this-&gt;string(),
                  'password' =&gt; $this-&gt;string(),
                  'authKey' =&gt; $this-&gt;string(),
                  'accessToken' =&gt; $this-&gt;string()
              ]);
  
              $this-&gt;insert('users',array(
                  'username'=&gt; SUPERUSER_LOGIN,
                  'password' =&gt; md5(SUPERUSER_PASS ),
                  'authKey' =&gt; 'key',
                  'accessToken' =&gt; ''
              ));
          }
      }
      public function down()
      {
          echo "m180616_200856_create_tables cannot be reverted.\n";
  
          return false;
      }
  
  }
  </code></pre>
  
  <p>When i run this migration, i get the error:</p>
  
  <pre><code>*** applying m180616_200856_create_tables
  Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: yii\db\mysql\Schema::getTable()'
  </code></pre>
  
  <p>If i include <code>use Yii</code> i get  the error:</p>
  
  <pre><code>*** applying m180616_200856_create_tables
  PHP Warning 'yii\base\ErrorException' with message 'The use statement with non-compound name 'Yii' has no effect'
  </code></pre>
  
  <p>So it seems i cannot use Yii namespace inside migration, how can i check if table exists?</p>