title: Ubuntu laravel production migration not working
body: <p>The migration works fine on my local server but on my production server which is a Ubuntu 18.04 it shows this error, it's really odd that it works fine on my localhost but not here, I have already looked around for possible solutions but nothing worked for me, I hope one of you can help me solve this problem!</p>
  <p>I'll got here below the migration where it goes wrong, and the MySQL error and I found a command where you could check for the latest MySQL foreign key error!</p>
  <pre><code>Brands migration:
  
  public function up()
  {
      Schema::create('brands', function (Blueprint $table) {
          $table-&gt;id();
          $table-&gt;string('brand_name')-&gt;unqiue;
          $table-&gt;integer('categories_id')-&gt;unsigned();
          $table-&gt;foreign('categories_id')
          -&gt;references('id')-&gt;on('categories')
          -&gt;onDelete('cascade');
          $table-&gt;boolean('brand_hidden');
          $table-&gt;string('brand_color');
          $table-&gt;timestamps();
      });
  }
  php artisan migrate:fresh:
  
  Dropped all tables successfully.
  Migration table created successfully.
  Migrating: 2014_10_12_000000_create_users_table
  Migrated:  2014_10_12_000000_create_users_table (0 seconds)
  Migrating: 2014_10_12_100000_create_password_resets_table
  Migrated:  2014_10_12_100000_create_password_resets_table (0 seconds)
  Migrating: 2019_08_19_000000_create_failed_jobs_table
  Migrated:  2019_08_19_000000_create_failed_jobs_table (0 seconds)
  Migrating: 2020_07_08_080611_create_categories_table
  Migrated:  2020_07_08_080611_create_categories_table (0 seconds)
  Migrating: 2020_07_08_124956_create_brands_table
  
     Illuminate\Database\QueryException
  
    SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `brands` add constraint `brands_categories_id_foreign` foreign key (`categories_id`) references `categories` (`id`) on delete cascade)
  
  
  Latest forein key error:
  
  2020-12-05 12:48:15 0x7f0680762700 Error in foreign key constraint of table laravel/#sql-1f8_19:
   foreign key (`categories_id`) references `categories` (`id`) on delete cascade:
  Cannot find an index in the referenced table where the
  referenced columns appear as the first columns, or column types
  in the table and the referenced table do not match for constraint.
  Note that the internal storage type of ENUM and SET changed in
  tables created with &gt;= InnoDB-4.1.12, and such columns in old tables
  cannot be referenced by such columns in new tables.
  Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-foreign-key-constraints.html for correct foreign key definition   
  </code></pre>