|
@@ -13,19 +13,23 @@ class CreateMessageTable extends Migration
|
|
|
*/
|
|
|
public function up()
|
|
|
{
|
|
|
- Schema::create('Message', function (Blueprint $table) {
|
|
|
+ Schema::create('messages', function (Blueprint $table) {
|
|
|
$table->id();
|
|
|
$table->string('title');
|
|
|
$table->text('body');
|
|
|
- $table->integer('from_id')->unsigned();
|
|
|
- $table->integer('to_id')->unsigned();
|
|
|
+ /*
|
|
|
+ *$table->integer('from_id')->unsigned();
|
|
|
+ *$table->integer('to_id')->unsigned();
|
|
|
+ */
|
|
|
+ $table->foreignId('from_id')->unique()->constrained('users')->onDelete('cascade');
|
|
|
+ $table->foreignId('to_id')->unique()->constrained('users')->onDelete('cascade');
|
|
|
$table->timestamps();
|
|
|
});
|
|
|
|
|
|
- Schema::table('Message', function(Blueprint $table){
|
|
|
- $table->foreign('from_id')->references('id')->on('users')->onDelete('cascade');
|
|
|
- $table->foreign('to_id')->references('id')->on('users')->onDelete('cascade');
|
|
|
- });
|
|
|
+ /*
|
|
|
+ *Schema::table('messages', function(Blueprint $table){
|
|
|
+ *});
|
|
|
+ */
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -35,6 +39,6 @@ class CreateMessageTable extends Migration
|
|
|
*/
|
|
|
public function down()
|
|
|
{
|
|
|
- Schema::dropIfExists('Message');
|
|
|
+ Schema::dropIfExists('messages');
|
|
|
}
|
|
|
}
|