laravel-learn-bbs/database/migrations/2018_06_10_164049_create_images_table.php

35 lines
747 B
PHP
Raw Normal View History

2018-06-10 09:25:41 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateImagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('images', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->index();
$table->enum('type', ['avatar', 'topic'])->index();
$table->string('path')->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('images');
}
}