1: <?php
2:
3: use Illuminate\Database\Migrations\Migration;
4: use Illuminate\Database\Schema\Blueprint;
5: use Illuminate\Database\Capsule\Manager as Capsule;
6:
7: class CreateCoreGroupUserTable extends Migration
8: {
9: /**
10: * Run the migrations.
11: *
12: * @return void
13: */
14: public function up()
15: {
16: Capsule::schema()->create('core_group_user', function (Blueprint $table) {
17: $table->increments('Id');
18: $table->integer('GroupId')->unsigned()->index();
19: $table->foreign('GroupId')->references('Id')->on('core_groups')->onDelete('cascade');
20: $table->integer('UserId')->unsigned()->index();
21: $table->foreign('UserId')->references('Id')->on('core_users')->onDelete('cascade');
22: });
23: }
24:
25: /**
26: * Reverse the migrations.
27: *
28: * @return void
29: */
30: public function down()
31: {
32: Capsule::schema()->dropIfExists('core_group_user');
33: }
34: }
35: