Files
nexusphp/database/migrations/2021_06_08_113437_create_snatched_table.php

48 lines
1.5 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSnatchedTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
2021-06-09 15:11:02 +08:00
if (Schema::hasTable('snatched')) {
return;
}
Schema::create('snatched', function (Blueprint $table) {
2022-11-05 18:43:49 +08:00
$table->bigIncrements('id', true);
$table->unsignedMediumInteger('torrentid')->default(0);
$table->unsignedMediumInteger('userid')->default(0)->index('userid');
$table->string('ip', 64)->default('');
$table->unsignedSmallInteger('port')->default(0);
$table->unsignedBigInteger('uploaded')->default(0);
$table->unsignedBigInteger('downloaded')->default(0);
$table->unsignedBigInteger('to_go')->default(0);
$table->unsignedInteger('seedtime')->default(0);
$table->unsignedInteger('leechtime')->default(0);
$table->dateTime('last_action')->nullable();
$table->dateTime('startdat')->nullable();
$table->dateTime('completedat')->nullable();
$table->enum('finished', ['yes', 'no'])->default('no');
2023-01-16 19:43:56 +08:00
$table->unique(['torrentid', 'userid'], 'torrentid_userid');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('snatched');
}
}