datatable.directory codebase https://datatable.directory/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
datatable.directory/database/migrations/2018_07_12_185431_create_ta...

44 lines
1.2 KiB

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableCommentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('table_comments', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->unsignedInteger('ancestor_id')->index()->nullable();
$table->unsignedInteger('author_id')->index();
$table->unsignedInteger('table_id')->index();
$table->text('message');
$table->foreign('table_id')->references('id')->on('tables')
->onDelete('cascade');
$table->foreign('author_id')->references('id')->on('users')
->onDelete('cascade');
$table->foreign('ancestor_id')->references('id')->on('table_comments')
->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('table_comments');
}
}