Chris
6 years ago
3 changed files with 52 additions and 0 deletions
@ -0,0 +1,35 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use Illuminate\Support\Facades\Schema; |
||||
|
use Illuminate\Database\Schema\Blueprint; |
||||
|
use Illuminate\Database\Migrations\Migration; |
||||
|
|
||||
|
class CreateSettingUserPivotTable extends Migration |
||||
|
{ |
||||
|
/** |
||||
|
* Run the migrations. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function up() |
||||
|
{ |
||||
|
Schema::create('setting_user', function (Blueprint $table) { |
||||
|
$table->integer('setting_id')->unsigned()->index(); |
||||
|
$table->foreign('setting_id')->references('id')->on('settings')->onDelete('cascade'); |
||||
|
$table->integer('user_id')->unsigned()->index(); |
||||
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); |
||||
|
$table->primary(['setting_id', 'user_id']); |
||||
|
$table->string('value')->nullable(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Reverse the migrations. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function down() |
||||
|
{ |
||||
|
Schema::dropIfExists('setting_user'); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue