Skip to content

Commit 4377370

Browse files
committed
remove foreign keys
1 parent cb7bf9e commit 4377370

3 files changed

+35
-6
lines changed

src/migrations/2014_10_28_175710_create_messages_table.php

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ public function up()
1818
$table->integer('user_id')->unsigned();
1919
$table->text('body');
2020
$table->timestamps();
21-
22-
$table->foreign('thread_id')->references('id')->on('threads');
23-
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade');
2421
});
2522
}
2623

src/migrations/2014_10_28_180224_create_participants_table.php

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ public function up()
1818
$table->integer('user_id')->unsigned();
1919
$table->timestamp('last_read');
2020
$table->timestamps();
21-
22-
$table->foreign('thread_id')->references('id')->on('threads');
23-
$table->foreign('user_id')->references('id')->on('users');
2421
});
2522
}
2623

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class RemoveForeignKeys extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::table('messages', function (Blueprint $table) {
16+
$table->dropForeign('messages_thread_id_foreign');
17+
$table->dropForeign('messages_user_id_foreign');
18+
});
19+
20+
Schema::table('participants', function (Blueprint $table) {
21+
$table->dropForeign('participants_thread_id_foreign');
22+
$table->dropForeign('participants_user_id_foreign');
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*
29+
* @return void
30+
*/
31+
public function down()
32+
{
33+
//
34+
}
35+
}

0 commit comments

Comments
 (0)