2022-05-05 22:19:48 +08:00
|
|
|
<?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()
|
|
|
|
|
{
|
2022-05-06 15:50:26 +08:00
|
|
|
if (Schema::hasTable('claims')) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-05-05 22:19:48 +08:00
|
|
|
Schema::create('claims', function (Blueprint $table) {
|
|
|
|
|
$table->id();
|
|
|
|
|
$table->integer('uid');
|
|
|
|
|
$table->integer('torrent_id')->index();
|
|
|
|
|
$table->integer('snatched_id')->index();
|
|
|
|
|
$table->bigInteger('seed_time_begin')->default(0);
|
|
|
|
|
$table->bigInteger('uploaded_begin')->default(0);
|
2022-05-06 15:50:26 +08:00
|
|
|
$table->dateTime('last_settle_at')->nullable()->index();
|
2022-05-05 22:19:48 +08:00
|
|
|
$table->timestamps();
|
|
|
|
|
$table->unique(['uid', 'torrent_id']);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reverse the migrations.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function down()
|
|
|
|
|
{
|
|
|
|
|
Schema::dropIfExists('claims');
|
|
|
|
|
}
|
|
|
|
|
};
|