Files
nexusphp/database/migrations/2021_06_08_113437_create_topics_table.php
T

45 lines
1.3 KiB
PHP
Raw Normal View History

2021-06-08 20:43:47 +08:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTopicsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
2021-06-09 15:11:02 +08:00
if (Schema::hasTable('topics')) {
return;
}
2021-06-08 20:43:47 +08:00
Schema::create('topics', function (Blueprint $table) {
$table->mediumIncrements('id');
2026-04-14 13:12:56 +07:00
$table->unsignedMediumInteger('userid')->default(0)->index();
$table->string('subject', 128)->default('')->index();
2021-06-08 20:43:47 +08:00
$table->enum('locked', ['yes', 'no'])->default('no');
$table->unsignedSmallInteger('forumid')->default(0);
$table->unsignedInteger('firstpost')->default(0);
$table->unsignedInteger('lastpost')->default(0);
$table->enum('sticky', ['no', 'yes'])->default('no');
$table->unsignedTinyInteger('hlcolor')->default(0);
$table->unsignedInteger('views')->default(0);
2026-04-14 13:12:56 +07:00
$table->index(['forumid', 'lastpost'], );
$table->index(['forumid', 'sticky', 'lastpost'], );
2021-06-08 20:43:47 +08:00
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('topics');
}
}