HelloCSE/database/migrations/2024_04_05_000003_create_comment_table.php
2024-04-10 13:56:22 +02:00

38 lignes
1 007 o
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCommentTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('profile_comment', function (Blueprint $table) {
$table->increments('id');
$table->string('content',500);
$table->integer('creator_id');
$table->integer('profile_id');
$table->integer('creation_date');
$table->integer('modification_date');
$table->unique(['creator_id', 'profile_id']);
$table->foreign('profile_id')->references('id')->on('profile');
$table->foreign('creator_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('profile_comment');
}
}