Make migrating after upgrading MySQL easier. (#12971)

Many people got stuck by this migration as it would fail on index creation after the table was created
This commit is contained in:
Tony Murray 2021-06-21 10:58:33 -05:00 committed by GitHub
parent 7ef302a8b9
commit ff55f674c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,11 @@ class CreatePortGroupsTable extends Migration
*/
public function up()
{
// drop table if exists, migration can fail when creating index.
if (Schema::hasTable('port_groups')) {
Schema::drop('port_groups');
}
Schema::create('port_groups', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();