mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-19 00:01:00 +08:00
peer add ipv6
This commit is contained in:
@@ -36,7 +36,7 @@ class CreatePeersTable extends Migration
|
||||
$table->unsignedBigInteger('downloadoffset')->default(0);
|
||||
$table->unsignedBigInteger('uploadoffset')->default(0);
|
||||
$table->char('passkey', 32)->default('');
|
||||
$table->unique(['torrent', 'peer_id', 'ip']);
|
||||
$table->unique(['torrent', 'peer_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ return new class extends Migration
|
||||
}
|
||||
|
||||
Schema::table($tableName, function (Blueprint $table) {
|
||||
$table->unique(['torrent', 'peer_id', 'ip']);
|
||||
$table->unique(['torrent', 'peer_id']);
|
||||
$table->index('peer_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('peers', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('peers', 'ipv4')) {
|
||||
$table->string('ipv4', 64)->default('');
|
||||
}
|
||||
if (!Schema::hasColumn('peers', 'ipv6')) {
|
||||
$table->string('ipv6', 64)->default('');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('peers', function (Blueprint $table) {
|
||||
$table->dropColumn(['ipv4', 'ipv6']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user