improve migration file + seedbox management

This commit is contained in:
xiaomlove
2022-07-21 15:42:12 +08:00
parent b2e3c2cce3
commit b507c41bf0
33 changed files with 577 additions and 12 deletions

View File

@@ -13,6 +13,9 @@ return new class extends Migration
*/
public function up()
{
if (Schema::hasColumn('users', 'attendance_card')) {
return;
}
Schema::table('users', function (Blueprint $table) {
$table->integer('attendance_card')->default(0);
});

View File

@@ -13,6 +13,9 @@ return new class extends Migration
*/
public function up()
{
if (Schema::hasColumn('torrents', 'cover')) {
return;
}
Schema::table('torrents', function (Blueprint $table) {
$table->string('cover')->default('')->after('save_as');
});

View File

@@ -13,6 +13,9 @@ return new class extends Migration
*/
public function up()
{
if (Schema::hasColumn('settings', 'autoload')) {
return;
}
Schema::table('settings', function (Blueprint $table) {
$table->enum('autoload', ['yes', 'no'])->default('yes');
});

View File

@@ -13,6 +13,9 @@ return new class extends Migration
*/
public function up()
{
if (Schema::hasColumn('torrents', 'approval_status')) {
return;
}
Schema::table('torrents', function (Blueprint $table) {
$table->integer('approval_status')->default(0);
});

View File

@@ -13,6 +13,9 @@ return new class extends Migration
*/
public function up()
{
if (Schema::hasColumn('torrents_state', 'deadline')) {
return;
}
Schema::table('torrents_state', function (Blueprint $table) {
$table->id();
$table->dateTime('deadline')->nullable();

View File

@@ -0,0 +1,41 @@
<?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::create('seedbox_records', function (Blueprint $table) {
$table->id();
$table->integer('type');
$table->integer('uid');
$table->string('operator')->nullable();
$table->integer('bandwidth')->nullable();
$table->string('ip')->nullable();
$table->string('ip_begin')->nullable();
$table->string('ip_end')->nullable();
$table->string('ip_begin_numeric', 128)->index();
$table->string('ip_end_numeric', 128)->index();
$table->string('comment')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('seedbox_records');
}
};