Вход Регистрация
Файл: database/migrations/2018_04_20_180005_create_articles_table.php
Строк: 35
<?php

declare(strict_types=1);

use 
IlluminateDatabaseMigrationsMigration;
use 
IlluminateDatabaseSchemaBlueprint;
use 
IlluminateSupportFacadesSchema;

final class 
CreateArticlesTable extends Migration
{
    
/**
     * Migrate Up.
     */
    
public function up(): void
    
{
        if (! 
Schema::hasTable('articles')) {
            
Schema::create('articles', function (Blueprint $table) {
                
$table->increments('id');
                
$table->integer('category_id');
                
$table->integer('user_id');
                
$table->string('title'50);
                
$table->text('text');
                
$table->string('tags'100);
                
$table->integer('rating')->default(0);
                
$table->integer('visits')->default(0);
                
$table->integer('count_comments')->default(0);
                
$table->integer('created_at');

                
$table->index('category_id');
                
$table->index('user_id');
                
$table->index('created_at');
                
$table->fullText(['title''text']);
            });
        }
    }

    
/**
     * Migrate Down.
     */
    
public function down(): void
    
{
        
Schema::dropIfExists('articles');
    }
}
Онлайн: 2
Реклама