mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix vendor_ouis duplicates in migration (#15202)
* Fix vendor_ouis duplicates in migration Can't trim the duplicates efficiently due to lacking an index on oui. * fix style * restrict columns to make strict group by happy.
This commit is contained in:
@ -11,6 +11,11 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// if duplicate entries, truncate the table. Hard to delete due to lacking index.
|
||||
if (DB::table('vendor_ouis')->select('oui')->havingRaw('count(oui) > 1')->groupBy('oui')->exists()) {
|
||||
DB::table('vendor_ouis')->truncate();
|
||||
}
|
||||
|
||||
Schema::table('vendor_ouis', function (Blueprint $table) {
|
||||
$table->string('oui', 12)->change();
|
||||
$table->unique(['oui']);
|
||||
|
Reference in New Issue
Block a user