mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Help users that did not upgrade MySQL try two (#12989)
This commit is contained in:
@@ -12,16 +12,24 @@ class CreatePortGroupsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// drop table if exists, migration can fail when creating index.
|
// migration can fail when creating index if the user's SQL server isn't new enough.
|
||||||
if (Schema::hasTable('port_groups')) {
|
if (Schema::hasTable('port_groups')) {
|
||||||
Schema::drop('port_groups');
|
$table = Schema::getConnection()->getDoctrineSchemaManager()
|
||||||
}
|
->listTableDetails('port_groups');
|
||||||
|
|
||||||
Schema::create('port_groups', function (Blueprint $table) {
|
// if the table exists and the index doesn't, add the index.
|
||||||
$table->increments('id');
|
if (! $table->hasIndex('port_groups_name_unique')) {
|
||||||
$table->string('name')->unique();
|
Schema::table('port_groups', function (Blueprint $table) {
|
||||||
$table->string('desc')->nullable();
|
$table->unique('name');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Schema::create('port_groups', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name')->unique();
|
||||||
|
$table->string('desc')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user