mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-16 05:50:55 +08:00
refactor exam progress + filter donate status
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateExamIndexInitValuesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('exam_index_init_values', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('uid')->index();
|
||||
$table->integer('exam_user_id');
|
||||
$table->integer('exam_id')->index();
|
||||
$table->integer('index')->index();
|
||||
$table->bigInteger('value');
|
||||
$table->timestamps();
|
||||
$table->unique(['exam_user_id', 'exam_id', 'index']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('exam_index_init_values');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddInitValueToExamProgressTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('exam_progress', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('exam_progress', 'init_value')) {
|
||||
$table->bigInteger('init_value')->default(0)->after('index');
|
||||
}
|
||||
//@todo open in beta10
|
||||
// $table->unique(['exam_user_id', 'index']);
|
||||
// $table->dropColumn('torrent_id');
|
||||
// $table->dropIndex('exam_progress_exam_user_id_index');
|
||||
// $table->dropIndex('exam_progress_created_at_index');
|
||||
});
|
||||
// \Illuminate\Support\Facades\DB::statement('alter table exam_progress modify created_at timestamp default current_timestamp');
|
||||
// \Illuminate\Support\Facades\DB::statement('alter table exam_progress modify updated_at timestamp default current_timestamp on update current_timestamp');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('exam_progress', function (Blueprint $table) {
|
||||
$table->dropColumn('init_value');
|
||||
// $table->dropUnique('exam_progress_exam_user_id_index_unique');
|
||||
// $table->integer('torrent_id')->after('uid');
|
||||
// $table->index('exam_user_id');
|
||||
// $table->index('created_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCompletedatIndexToSnatchedTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('snatched', function (Blueprint $table) {
|
||||
$table->index('completedat');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('snatched', function (Blueprint $table) {
|
||||
$table->dropIndex('snatched_completedat_index');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user