Файл: database/migrations/2018_04_20_180010_create_comments_table.php
Строк: 47
<?php
use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;
return new class extends Migration {
public function up(): void
{
if (! Schema::hasTable('comments')) {
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('parent_id')->nullable();
$table->unsignedTinyInteger('depth')->default(0);
$table->integer('user_id');
$table->string('relate_type', 20);
$table->integer('relate_id');
$table->text('text');
$table->integer('rating')->default(0);
$table->ipAddress('ip');
$table->string('brow', 25);
$table->dateTime('created_at')->nullable();
$table->dateTime('deleted_at')->nullable();
$table->index('parent_id');
$table->index('created_at');
$table->index(['rating', 'created_at']);
$table->index(['relate_type', 'relate_id']);
});
}
}
public function down(): void
{
Schema::dropIfExists('comments');
}
};