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.
45 lines
1.2 KiB
45 lines
1.2 KiB
6 years ago
|
<?php
|
||
|
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
|
||
6 years ago
|
class CreateTableCommentsTable extends Migration
|
||
6 years ago
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
6 years ago
|
Schema::create('table_comments', function (Blueprint $table) {
|
||
6 years ago
|
$table->increments('id');
|
||
|
$table->timestamps();
|
||
|
$table->unsignedInteger('ancestor_id')->index()->nullable();
|
||
|
$table->unsignedInteger('author_id')->index();
|
||
|
$table->unsignedInteger('data_table_id')->index();
|
||
|
$table->text('message');
|
||
|
|
||
|
$table->foreign('data_table_id')->references('id')->on('data_tables')
|
||
|
->onDelete('cascade');
|
||
|
|
||
|
$table->foreign('author_id')->references('id')->on('users')
|
||
|
->onDelete('cascade');
|
||
|
|
||
|
$table->foreign('ancestor_id')->references('id')->on('comments')
|
||
|
->onDelete('set null');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
6 years ago
|
Schema::dropIfExists('table_comments');
|
||
6 years ago
|
}
|
||
|
}
|